package com.ham.mud.commands;

import com.ham.mud.ServerConnection;
import com.ham.mud.Targetable;

/**
 * Created by hlucas on Jun 16, 2011 at 12:41:11 PM
 */
public abstract class PlayerCommand implements Targetable {
    String[] params;
    public void execute(ServerConnection connection) {
        execute(connection, params);
    }
    public abstract void execute(ServerConnection connection, String[] params);
    protected abstract String getCommandName();

    public String[] getTargetingKeys() {
        return new String[]{getCommandName()};
    }

    public void setParams(String[] params) {
        this.params = params;
    }

    @Override
    public boolean equals(Object obj) {
        if(obj instanceof PlayerCommand) {
            return ((PlayerCommand)obj).getCommandName().equals(getCommandName());
        }
        return false;
    }
}
